package com.yc.cinema;

import org.springframework.stereotype.Component;

// 组件注解, 相当于在业务类上直接加 @Bean
// HardDisk ==> hardDisk
@Component("hd")
public class HardDisk implements Storage {
    private Object data;

    @Override
    public void save(Object data) {
        System.out.println("保存数据到硬盘: " + data);
        this.data = data;
    }

    @Override
    public Object load() {
        return data;
    }
}
